Skip to content

Conversation

GiveMe-A-Name
Copy link
Member

Summary

Related links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@Copilot Copilot AI review requested due to automatic review settings September 4, 2025 08:26
@GiveMe-A-Name GiveMe-A-Name marked this pull request as draft September 4, 2025 08:26
Copy link

netlify bot commented Sep 4, 2025

Deploy Preview for rspack ready!

Name Link
🔨 Latest commit e2350d7
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/68b94d2a9b9be40008c20ff6
😎 Deploy Preview https://deploy-preview-11581--rspack.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions bot added the team The issue/pr is created by the member of Rspack. label Sep 4, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds event emitter functionality to the native file watcher system, enabling watch file systems to emit, listen for, and handle file system events through standard event patterns.

  • Extended the WatchFileSystem interface with event emitter methods (on, once, emit)
  • Modified the native watcher to emit "change" and "remove" events with proper event data
  • Updated Rust event handlers to include modification time information and renamed delete operations to remove

Reviewed Changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/rspack/src/util/fs.ts Adds optional event emitter interface methods to WatchFileSystem
packages/rspack/src/node/NodeWatchFileSystem.ts Implements event emitter methods for Node.js-based file watching
packages/rspack/src/NativeWatchFileSystem.ts Implements event emitter methods for native file watching with internal EventEmitter
packages/rspack/etc/core.api.md Updates public API documentation to include new event emitter methods
crates/rspack_fs/src/watcher/mod.rs Updates Rust trait to include mtime parameter and renames delete to remove
crates/rspack_fs/src/watcher/executor.rs Updates event handler calls to match new trait signature
crates/rspack_binding_api/src/native_watcher.rs Modifies JS binding to pass event type and mtime data to callbacks

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

(type: "change" | "remove", fileName: string, mtime?: number) => {
// FIXME: napi-rs will pass all arguments as array
// @ts-ignore
console.log("NativeWatchFileSystem event", type, fileName, mtime);
Copy link
Preview

Copilot AI Sep 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug console.log statement should be removed before merging to production. Consider using a proper logging mechanism or removing this line entirely.

Suggested change
console.log("NativeWatchFileSystem event", type, fileName, mtime);

Copilot uses AI. Check for mistakes.

@@ -1,9 +1,11 @@
use std::{
alloc::System,
Copy link
Preview

Copilot AI Sep 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alloc::System import appears to be unused. This import should be removed to avoid clutter.

Suggested change
alloc::System,

Copilot uses AI. Check for mistakes.

};

use napi::bindgen_prelude::*;
use napi::{JsUndefined, bindgen_prelude::*};
Copy link
Preview

Copilot AI Sep 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JsUndefined import appears to be unused. This import should be removed to avoid clutter.

Suggested change
use napi::{JsUndefined, bindgen_prelude::*};
use napi::bindgen_prelude::*;

Copilot uses AI. Check for mistakes.

@GiveMe-A-Name GiveMe-A-Name changed the title Feat/native watcher on emit WIP Feat/native watcher on emit Sep 4, 2025
Copy link
Contributor

github-actions bot commented Sep 4, 2025

📦 Binary Size-limit

Comparing e2350d7 to perf: improve exports info (#11524) by harpsealjs

❌ Size increased by 3.50KB from 47.28MB to 47.28MB (⬆️0.01%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team The issue/pr is created by the member of Rspack.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant